﻿@model HeaderLinksModel
@using Nop.Web.Models.Common;
<div class="header-links">
    <ul>
        @if (Model.IsCustomerImpersonated)
        {
@*customer is impersonated *@
            <li><span class="impersonate">(@(string.Format(T("Account.ImpersonatedAs").Text, Model.CustomerEmailUsername)))
                - <a href="@Url.RouteUrl("Logout")" class="finish-impersonation" title="@T("Account.ImpersonatedAs.Finish.Hint")">@T("Account.ImpersonatedAs.Finish")</a>
                ) </span></li>
        }
        @if (Model.IsAuthenticated)
        {
            <li><a href="@Url.RouteUrl("CustomerInfo")" class="account">@Model.CustomerEmailUsername</a></li>
            <li><a href="@Url.RouteUrl("Logout")" class="ico-logout">@T("Account.Logout")</a></li>
            
            if (Model.AllowPrivateMessages)
            {
            <li><a href="@Url.RouteUrl("PrivateMessages", new { tab = "" })" class="ico-inbox">@T("PrivateMessages.Inbox")</a>
                @Model.UnreadPrivateMessages</li>
                if (!string.IsNullOrEmpty(Model.AlertMessage))
                {
                    //using $(document).bind instead of $(document).ready to execute the alert after tabs load (on privatemessages page)
            <script type="text/javascript">
                $(document).bind("ready", function () {
                    alert('@Model.AlertMessage');
                });
            </script>
                }
            }
        }
        else
        {
            <li><a href="@Url.RouteUrl("Register")" class="ico-register">@T("Account.Register")</a></li>
            <li><a href="@Url.RouteUrl("Login")" class="ico-login">@T("Account.Login")</a></li>
        }
        @if (Model.ShoppingCartEnabled)
        {
            <li><a href="@Url.RouteUrl("ShoppingCart")" class="ico-cart">@T("ShoppingCart")</a>
                <a href="@Url.RouteUrl("ShoppingCart")">(@Model.ShoppingCartItems)</a> </li>
        }
        @if (Model.WishlistEnabled)
        {
            <li><a href="@Url.RouteUrl("Wishlist")" class="ico-wishlist">@T("Wishlist")</a> <a href="@Url.RouteUrl("Wishlist")">
                (@Model.WishlistItems)</a> </li>
        }
        @if (Model.DisplayAdminLink)
        {
            <li><a href="@Url.Content("~/admin")" class="ico-admin">@T("Account.Administration")</a>
            </li>
        }
        @Html.Action("WidgetsByZone", "Widget", new { widgetZone = Nop.Core.Domain.Cms.WidgetZone.HeaderLinks })
    </ul>
</div>
